﻿using LX.NHibernate.Data.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace LX.NHibernate.Service.Implement
{
    public class User_InfoManage : IUser_InfoManage
    {
        private LX.NHibernate.Data.DAL.IUser_InfoRepository userInfoDao;
        public User_InfoManage()
        {
            userInfoDao = new Data.DAL.Implement.User_InfoRepository();
        }
        public object User_InfoAdd(Data.Domain.User_Info modelUser_Info)
        {
            return userInfoDao.Insert(modelUser_Info);
        }

        public void User_InfoDelete(Data.Domain.User_Info modelUser_Info)
        {
            userInfoDao.Delete(modelUser_Info);
        }

        public void User_InfoEdit(Data.Domain.User_Info modelUser_Info)
        {
            userInfoDao.Update(modelUser_Info);
        }

        public Data.Domain.User_Info GetUser_Info(object UserId)
        {
            return userInfoDao.Get(UserId);
        }

        public List<Data.Domain.User_Info> GetUser_InfoList()
        {
            return userInfoDao.LoadAll();
        }

        /// <summary>
        /// 分页条件查询和排序
        /// </summary>
        /// <param name="where"></param>
        /// <param name="order"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="Total"></param>
        /// <returns></returns>
        public IList<Data.Domain.User_Info> GetUser_InfoListForPage(Expression<Func<Data.Domain.User_Info, bool>> where, Expression<Func<Data.Domain.User_Info, object>> order, int pageIndex, int pageSize, out int Total)
        {
            return userInfoDao.GetListForPage(where, order, pageIndex, pageSize, out Total);
        }
    }
}
